<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <button>按钮</button>
    <input type="checkbox" name="" id="" checked="checkked" />

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script>
      $(() => {
        $('button').on('click', function () {
          console.log(11);
          if ($('input').prop('checked')) {
            $('input').prop('checked', false)
          } else {
            $('input').prop('checked', true)
          }
        })
      })
    </script>
  </body>
</html>
